
import java.awt.Cursor;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;


public class frm_clinicas extends javax.swing.JFrame {

    public static String nivel_acesso;
    /** Creates new form frm_clinicas */
    public frm_clinicas(String nivel_acesso) {
        this.nivel_acesso = nivel_acesso;
        initComponents();
        try {  
            javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");  
            javax.swing.SwingUtilities.updateComponentTreeUI(this);  
        } catch (Exception e) {  
        e.printStackTrace();  
        }
        btn_salvar.setEnabled(false);
        setExtendedState(MAXIMIZED_BOTH);
        nomeBotoes();
        maoBotoes();
        verificarNivelAcesso();
    }
    
    int id_clinica;
    String nome;
    String apto;
    String bairro;
    String celular;
    String cidade;
    String cnpj;
    String email;
    String endereco;
    String numero;
    String razao_social;
    String telefone;
    String uf;

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        btn_novo = new javax.swing.JButton();
        btn_excluir = new javax.swing.JButton();
        btn_salvar = new javax.swing.JButton();
        btn_alterar = new javax.swing.JButton();
        btn_editar = new javax.swing.JButton();
        jp_dados_da_clinica = new javax.swing.JPanel();
        lbl_codigo = new javax.swing.JLabel();
        tf_codigo = new javax.swing.JTextField();
        lbl_nome = new javax.swing.JLabel();
        tf_nome = new javax.swing.JTextField();
        lbl_razao_social = new javax.swing.JLabel();
        tf_razao_social = new javax.swing.JTextField();
        lbl_cnpj = new javax.swing.JLabel();
        tf_cnpj = new javax.swing.JFormattedTextField();
        jp_dados_residenciais = new javax.swing.JPanel();
        lbl_endereco = new javax.swing.JLabel();
        tf_endereco = new javax.swing.JTextField();
        lbl_numero = new javax.swing.JLabel();
        tf_numero = new javax.swing.JTextField();
        lbl_cidade = new javax.swing.JLabel();
        tf_cidade = new javax.swing.JTextField();
        lbl_bairro = new javax.swing.JLabel();
        tf_bairro = new javax.swing.JTextField();
        lbl_apto = new javax.swing.JLabel();
        tf_apto = new javax.swing.JTextField();
        lbl_uf = new javax.swing.JLabel();
        cb_uf = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        lbl_email = new javax.swing.JLabel();
        tf_email = new javax.swing.JTextField();
        lbl_fone_fax = new javax.swing.JLabel();
        tf_telefone = new javax.swing.JFormattedTextField();
        lbl_celular = new javax.swing.JLabel();
        tf_celular = new javax.swing.JFormattedTextField();
        jp_pesquisa = new javax.swing.JPanel();
        lbl_filtrar = new javax.swing.JLabel();
        cb_filtrar = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        tf_pesquisar = new javax.swing.JTextField();
        btn_pesquisar = new javax.swing.JButton();
        jp_clinicas = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_clinicas = new javax.swing.JTable();
        jm_menu = new javax.swing.JMenuBar();
        jm_menu_opcoes = new javax.swing.JMenu();
        jm_menu_backup = new javax.swing.JMenuItem();
        jm_menu_restaurar_backup = new javax.swing.JMenuItem();
        jm_menu_usuarios = new javax.swing.JMenuItem();
        jm_menu_sair = new javax.swing.JMenuItem();
        jm_menu_gerenciar = new javax.swing.JMenu();
        jm_menu_clinicas = new javax.swing.JMenuItem();
        jm_menu_dentistas = new javax.swing.JMenuItem();
        jm_menu_pacientes = new javax.swing.JMenuItem();
        jm_menu_ordem_de_servico = new javax.swing.JMenuItem();
        jm_menu_ajuda = new javax.swing.JMenu();
        jm_menu_conteudo_ajuda = new javax.swing.JMenuItem();
        jm_menu_sobre = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Clínica de Próteses | Clínicas");

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        btn_novo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/img_novo.png"))); // NOI18N
        btn_novo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_novoActionPerformed(evt);
            }
        });

        btn_excluir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/img_excluir.png"))); // NOI18N
        btn_excluir.setMaximumSize(new java.awt.Dimension(65, 41));
        btn_excluir.setMinimumSize(new java.awt.Dimension(65, 41));
        btn_excluir.setPreferredSize(new java.awt.Dimension(65, 41));

        btn_salvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/img_salvar.png"))); // NOI18N
        btn_salvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_salvarActionPerformed(evt);
            }
        });

        btn_alterar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/img_alterar.png"))); // NOI18N
        btn_alterar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_alterarActionPerformed(evt);
            }
        });

        btn_editar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/img_editar.png"))); // NOI18N
        btn_editar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_editarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(btn_novo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btn_salvar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btn_excluir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btn_editar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btn_alterar)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(btn_novo)
                    .addComponent(btn_salvar)
                    .addComponent(btn_excluir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btn_editar)
                    .addComponent(btn_alterar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jp_dados_da_clinica.setBackground(new java.awt.Color(255, 255, 255));
        jp_dados_da_clinica.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dados da Clínica:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 18), new java.awt.Color(0, 102, 153))); // NOI18N
        jp_dados_da_clinica.setForeground(new java.awt.Color(255, 255, 255));

        lbl_codigo.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_codigo.setText("Código:");

        tf_codigo.setEditable(false);
        tf_codigo.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_nome.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_nome.setText("Nome:*");

        tf_nome.setEditable(false);
        tf_nome.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_razao_social.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_razao_social.setText("R.Social:*");

        tf_razao_social.setEditable(false);
        tf_razao_social.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_cnpj.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_cnpj.setText("CNPJ:*");

        tf_cnpj.setEditable(false);
        try {
            tf_cnpj.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##.###.###/####-##")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        tf_cnpj.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        javax.swing.GroupLayout jp_dados_da_clinicaLayout = new javax.swing.GroupLayout(jp_dados_da_clinica);
        jp_dados_da_clinica.setLayout(jp_dados_da_clinicaLayout);
        jp_dados_da_clinicaLayout.setHorizontalGroup(
            jp_dados_da_clinicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_dados_da_clinicaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jp_dados_da_clinicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_codigo)
                    .addComponent(lbl_nome)
                    .addComponent(lbl_razao_social)
                    .addComponent(lbl_cnpj))
                .addGap(18, 18, 18)
                .addGroup(jp_dados_da_clinicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tf_cnpj, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tf_nome, javax.swing.GroupLayout.DEFAULT_SIZE, 323, Short.MAX_VALUE)
                    .addComponent(tf_razao_social))
                .addContainerGap(203, Short.MAX_VALUE))
        );
        jp_dados_da_clinicaLayout.setVerticalGroup(
            jp_dados_da_clinicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_dados_da_clinicaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jp_dados_da_clinicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_codigo)
                    .addComponent(tf_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jp_dados_da_clinicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_nome)
                    .addComponent(tf_nome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jp_dados_da_clinicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_razao_social)
                    .addComponent(tf_razao_social, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jp_dados_da_clinicaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_cnpj)
                    .addComponent(tf_cnpj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jp_dados_residenciais.setBackground(new java.awt.Color(255, 255, 255));
        jp_dados_residenciais.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dados Residênciais:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 18), new java.awt.Color(0, 102, 153))); // NOI18N

        lbl_endereco.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_endereco.setText("Endereço:*");

        tf_endereco.setEditable(false);
        tf_endereco.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_numero.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_numero.setText("Número:");

        tf_numero.setEditable(false);
        tf_numero.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_cidade.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_cidade.setText("Cidade:*");

        tf_cidade.setEditable(false);
        tf_cidade.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_bairro.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_bairro.setText("Bairro:");

        tf_bairro.setEditable(false);
        tf_bairro.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_apto.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_apto.setText("Apto:");

        tf_apto.setEditable(false);
        tf_apto.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_uf.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_uf.setText("UF:");

        cb_uf.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "---", "AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO" }));

        javax.swing.GroupLayout jp_dados_residenciaisLayout = new javax.swing.GroupLayout(jp_dados_residenciais);
        jp_dados_residenciais.setLayout(jp_dados_residenciaisLayout);
        jp_dados_residenciaisLayout.setHorizontalGroup(
            jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_dados_residenciaisLayout.createSequentialGroup()
                .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jp_dados_residenciaisLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_endereco)
                            .addGroup(jp_dados_residenciaisLayout.createSequentialGroup()
                                .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lbl_apto)
                                    .addComponent(lbl_cidade))
                                .addGap(18, 18, 18)
                                .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tf_cidade, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(tf_apto, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lbl_bairro)
                                    .addComponent(lbl_uf))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tf_bairro, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
                                    .addComponent(cb_uf, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(jp_dados_residenciaisLayout.createSequentialGroup()
                        .addGap(88, 88, 88)
                        .addComponent(tf_endereco, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lbl_numero)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tf_numero)))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        jp_dados_residenciaisLayout.setVerticalGroup(
            jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_dados_residenciaisLayout.createSequentialGroup()
                .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(tf_endereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_endereco)
                    .addComponent(lbl_numero)
                    .addComponent(tf_numero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jp_dados_residenciaisLayout.createSequentialGroup()
                        .addComponent(lbl_apto)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lbl_cidade))
                    .addGroup(jp_dados_residenciaisLayout.createSequentialGroup()
                        .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tf_apto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_uf)
                            .addComponent(cb_uf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jp_dados_residenciaisLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tf_cidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbl_bairro)
                            .addComponent(tf_bairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(21, Short.MAX_VALUE))
        );

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dados de Contato:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 16), new java.awt.Color(0, 102, 153))); // NOI18N

        lbl_email.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_email.setText("E-mail:");

        tf_email.setEditable(false);
        tf_email.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_fone_fax.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_fone_fax.setText("Fone/Fax:*");

        tf_telefone.setEditable(false);
        try {
            tf_telefone.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        tf_telefone.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        lbl_celular.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_celular.setText("Celular:");

        tf_celular.setEditable(false);
        try {
            tf_celular.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        tf_celular.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_email)
                    .addComponent(lbl_fone_fax))
                .addGap(10, 10, 10)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(tf_telefone, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(lbl_celular)
                        .addGap(18, 18, 18)
                        .addComponent(tf_celular, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(tf_email, javax.swing.GroupLayout.PREFERRED_SIZE, 322, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_email)
                    .addComponent(tf_email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_fone_fax)
                    .addComponent(tf_telefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbl_celular)
                    .addComponent(tf_celular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jp_pesquisa.setBackground(new java.awt.Color(255, 255, 255));
        jp_pesquisa.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Pesquisa:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 18), new java.awt.Color(0, 102, 153))); // NOI18N

        lbl_filtrar.setFont(new java.awt.Font("Calibri", 1, 16)); // NOI18N
        lbl_filtrar.setText("Filtrar por:");

        cb_filtrar.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        cb_filtrar.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Todos", "Código", "Nome", "CNPJ" }));

        jLabel2.setText("=");

        tf_pesquisar.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

        btn_pesquisar.setText("Pesquisar");
        btn_pesquisar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_pesquisarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jp_pesquisaLayout = new javax.swing.GroupLayout(jp_pesquisa);
        jp_pesquisa.setLayout(jp_pesquisaLayout);
        jp_pesquisaLayout.setHorizontalGroup(
            jp_pesquisaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_pesquisaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lbl_filtrar)
                .addGap(18, 18, 18)
                .addComponent(cb_filtrar, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tf_pesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btn_pesquisar)
                .addContainerGap())
        );
        jp_pesquisaLayout.setVerticalGroup(
            jp_pesquisaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_pesquisaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jp_pesquisaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_filtrar)
                    .addComponent(cb_filtrar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(tf_pesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btn_pesquisar))
                .addContainerGap(23, Short.MAX_VALUE))
        );

        jp_clinicas.setBackground(new java.awt.Color(255, 255, 255));
        jp_clinicas.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Clinicas:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 1, 18), new java.awt.Color(0, 102, 153))); // NOI18N

        jt_clinicas.setAutoCreateRowSorter(true);
        jt_clinicas.setFont(new java.awt.Font("Calibri", 0, 10)); // NOI18N
        jt_clinicas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Cód", "Nome", "R.Social", "CNPJ", "E-mail", "Telefone", "Celular", "Endereço", "Número", "Apto", "UF", "Cidade", "Bairro"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jt_clinicas.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        jScrollPane1.setViewportView(jt_clinicas);

        javax.swing.GroupLayout jp_clinicasLayout = new javax.swing.GroupLayout(jp_clinicas);
        jp_clinicas.setLayout(jp_clinicasLayout);
        jp_clinicasLayout.setHorizontalGroup(
            jp_clinicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_clinicasLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1)
                .addContainerGap())
        );
        jp_clinicasLayout.setVerticalGroup(
            jp_clinicasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_clinicasLayout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jm_menu_opcoes.setText("Opções");
        jm_menu_opcoes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_menu_opcoesActionPerformed(evt);
            }
        });

        jm_menu_backup.setText("Backup");
        jm_menu_backup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_menu_backupActionPerformed(evt);
            }
        });
        jm_menu_opcoes.add(jm_menu_backup);

        jm_menu_restaurar_backup.setText("Restaurar backup");
        jm_menu_restaurar_backup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_menu_restaurar_backupActionPerformed(evt);
            }
        });
        jm_menu_opcoes.add(jm_menu_restaurar_backup);

        jm_menu_usuarios.setText("Gerenciar usuários");
        jm_menu_opcoes.add(jm_menu_usuarios);

        jm_menu_sair.setText("Sair");
        jm_menu_sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_menu_sairActionPerformed(evt);
            }
        });
        jm_menu_opcoes.add(jm_menu_sair);

        jm_menu.add(jm_menu_opcoes);

        jm_menu_gerenciar.setText("Gerenciar");

        jm_menu_clinicas.setText("Clinicas");
        jm_menu_clinicas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_menu_clinicasActionPerformed(evt);
            }
        });
        jm_menu_gerenciar.add(jm_menu_clinicas);

        jm_menu_dentistas.setText("Dentistas");
        jm_menu_dentistas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_menu_dentistasActionPerformed(evt);
            }
        });
        jm_menu_gerenciar.add(jm_menu_dentistas);

        jm_menu_pacientes.setText("Pacientes");
        jm_menu_pacientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_menu_pacientesActionPerformed(evt);
            }
        });
        jm_menu_gerenciar.add(jm_menu_pacientes);

        jm_menu_ordem_de_servico.setText("Ordem de Serviço");
        jm_menu_ordem_de_servico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jm_menu_ordem_de_servicoActionPerformed(evt);
            }
        });
        jm_menu_gerenciar.add(jm_menu_ordem_de_servico);

        jm_menu.add(jm_menu_gerenciar);

        jm_menu_ajuda.setText("Ajuda");

        jm_menu_conteudo_ajuda.setText("Conteúdo da ajuda");
        jm_menu_ajuda.add(jm_menu_conteudo_ajuda);

        jm_menu_sobre.setText("Sobre");
        jm_menu_ajuda.add(jm_menu_sobre);

        jm_menu.add(jm_menu_ajuda);

        setJMenuBar(jm_menu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jp_dados_da_clinica, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jp_dados_residenciais, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jp_clinicas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jp_pesquisa, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jp_dados_da_clinica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jp_dados_residenciais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jp_pesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jp_clinicas, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE)))
                .addContainerGap(88, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    public void verificarNivelAcesso(){
        if(nivel_acesso.equals("Operador")){
            jm_menu_usuarios.setEnabled(false);
            jm_menu_usuarios.setVisible(false);       
        }
        else{
            jm_menu_usuarios.setEnabled(true);
            jm_menu_usuarios.setVisible(true);
        }
    }
    
    public void nomeBotoes(){
        btn_novo.setToolTipText("Novo cadastro");
        btn_salvar.setToolTipText("Salvar");
        btn_excluir.setToolTipText("Excluir");
        btn_editar.setToolTipText("Editar");
        btn_alterar.setToolTipText("Alterar");
    }

    public void maoBotoes(){
        btn_novo.setCursor(new Cursor(Cursor.HAND_CURSOR));
        btn_salvar.setCursor(new Cursor(Cursor.HAND_CURSOR));
        btn_excluir.setCursor(new Cursor(Cursor.HAND_CURSOR));
        btn_editar.setCursor(new Cursor(Cursor.HAND_CURSOR));
        btn_alterar.setCursor(new Cursor(Cursor.HAND_CURSOR));        
    }
    
    private void btn_novoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_novoActionPerformed
        limparCampos();
        incrementarCodigo();
        habilitarCampos();
        btn_salvar.setEnabled(true);
    }//GEN-LAST:event_btn_novoActionPerformed

    private void btn_salvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_salvarActionPerformed
        ClinicaController clinicaController;
        id_clinica = Integer.parseInt(tf_codigo.getText());
        nome = tf_nome.getText();
        apto = tf_apto.getText();
        bairro = tf_bairro.getText();
        celular = tf_celular.getText();
        cidade = tf_cidade.getText();
        cnpj = tf_cnpj.getText();
        email = tf_email.getText();
        endereco = tf_endereco.getText();
        numero = tf_numero.getText();
        razao_social = tf_razao_social.getText();
        telefone = tf_telefone.getText();
        uf = cb_uf.getSelectedItem()+"";
        
        clinicaController = new ClinicaController();
        if(validarFormulario()){
            if(clinicaController.cadastrarClinica(nome,apto,bairro,celular,cidade,cnpj,email,
                    endereco,numero,razao_social,telefone,uf)){
                JOptionPane.showMessageDialog(this,"Clínica cadastrada com sucesso.");
                limparCampos();
                desabilitarCampos();
            }
            else{
                JOptionPane.showMessageDialog(this,"Problema na gravação.");
            }
        }
        else{
            JOptionPane.showMessageDialog(this,"Campos com * são obrigatórios.");
        }
        
    }//GEN-LAST:event_btn_salvarActionPerformed

    
    public void habilitarCampos(){
        tf_nome.setEditable(true);
        tf_apto.setEditable(true);
        tf_bairro.setEditable(true);
        tf_celular.setEditable(true);
        tf_cidade.setEditable(true);
        tf_cnpj.setEditable(true);
        tf_email.setEditable(true);
        tf_endereco.setEditable(true);
        tf_numero.setEditable(true);
        tf_razao_social.setEditable(true);
        tf_telefone.setEditable(true);
    }
    
    public void desabilitarCampos(){
        tf_nome.setEditable(false);
        tf_apto.setEditable(false);
        tf_bairro.setEditable(false);
        tf_celular.setEditable(false);
        tf_cidade.setEditable(false);
        tf_cnpj.setEditable(false);
        tf_email.setEditable(false);
        tf_endereco.setEditable(false);
        tf_numero.setEditable(false);
        tf_razao_social.setEditable(false);
        tf_telefone.setEditable(false);
    }
    
    /*
    * Método para validar se campos obrigatorios para o cadastro
    * estao corretamento preenchidos.
    */
    public boolean validarFormulario(){
        if(nome.equals("")||razao_social.equals("")||cnpj.equals("")||telefone.equals("")
                ||endereco.equals("")||cidade.equals("")){
            return false;
        }
        else{
            return true;
        }
    }
    
    public void limparTabelaClinica(){
       int linha = jt_clinicas.getRowCount();
       int coluna = jt_clinicas.getColumnCount();
       for(int i=0; i<linha; i++) 
           for(int j=0; j<coluna; j++){
               jt_clinicas.setValueAt("", i, j);
           }
    }
    
    
    private void btn_pesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_pesquisarActionPerformed
       btn_salvar.setEnabled(false);
       limparCampos();
       ClinicaController clinicaController = new ClinicaController();
       String filtrar_por = cb_filtrar.getSelectedItem()+"";
       String pesquisar = tf_pesquisar.getText();
       limparTabelaClinica();
       clinicaController.buscarClinica(filtrar_por,pesquisar);
        
    }//GEN-LAST:event_btn_pesquisarActionPerformed

    private void btn_alterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_alterarActionPerformed
        ClinicaController clinicaController = new ClinicaController();
        id_clinica = Integer.parseInt(tf_codigo.getText());
        nome = tf_nome.getText();
        apto = tf_apto.getText();
        bairro = tf_bairro.getText();
        celular = tf_celular.getText();
        cidade = tf_cidade.getText();
        cnpj = tf_cnpj.getText();
        email = tf_email.getText();
        endereco = tf_endereco.getText();
        numero = tf_numero.getText();
        razao_social = tf_razao_social.getText();
        telefone = tf_telefone.getText();
        uf = cb_uf.getSelectedItem()+"";
        
        if(validarFormulario()){
            if(clinicaController.alterarClinica(id_clinica,nome,apto,bairro,celular,cidade,cnpj,email,
                    endereco,numero,razao_social,telefone,uf)){
                JOptionPane.showMessageDialog(this,"Clínica alterada com sucesso.");
                desabilitarCampos();
                limparCampos();
            }
            else{
                JOptionPane.showMessageDialog(this,"Problema na gravação.");
            }
        }
        else{
            JOptionPane.showMessageDialog(this,"Campos com * são obrigatórios.");
        }
    }//GEN-LAST:event_btn_alterarActionPerformed

    private void btn_editarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_editarActionPerformed
        btn_salvar.setEnabled(false);
        ClinicaController clinicaController = new ClinicaController();
        int linha = jt_clinicas.getSelectedRow();
        int id_cli = clinicaController.buscarIDdeTabela(linha);
        try{
            habilitarCampos();
            clinicaController.editarClinica(id_cli); 
        }catch(Exception e){JOptionPane.showMessageDialog(this,"Selecione um registro.");}
    }//GEN-LAST:event_btn_editarActionPerformed

    private void jm_menu_backupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_menu_backupActionPerformed
        Base base = new Base();
        int resp = JOptionPane.showConfirmDialog(null, "Realizar Backup?", "Backup", JOptionPane.YES_NO_OPTION);
        if (resp == JOptionPane.YES_OPTION) {
            base.backup();
        }
    }//GEN-LAST:event_jm_menu_backupActionPerformed

    private void jm_menu_restaurar_backupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_menu_restaurar_backupActionPerformed
        Base base = new Base();
        int resp = JOptionPane.showConfirmDialog(null, "Realizar Backup?", "Backup", JOptionPane.YES_NO_OPTION);
        if (resp == JOptionPane.YES_OPTION) {
            base.restaurarBackup();
        }
    }//GEN-LAST:event_jm_menu_restaurar_backupActionPerformed

    private void jm_menu_sairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_menu_sairActionPerformed
        dispose();
    }//GEN-LAST:event_jm_menu_sairActionPerformed

    private void jm_menu_opcoesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_menu_opcoesActionPerformed


  }//GEN-LAST:event_jm_menu_opcoesActionPerformed

    private void jm_menu_clinicasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_menu_clinicasActionPerformed
        frm_clinicas clinicas = new frm_clinicas(nivel_acesso);
        clinicas.setVisible(true);
        // this.setVisible(false);
    }//GEN-LAST:event_jm_menu_clinicasActionPerformed

    private void jm_menu_dentistasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_menu_dentistasActionPerformed
        frm_dentistas dentistas = new frm_dentistas(nivel_acesso);
        dentistas.setVisible(true);
        //  this.setVisible(false);
    }//GEN-LAST:event_jm_menu_dentistasActionPerformed

    private void jm_menu_pacientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_menu_pacientesActionPerformed
        frm_pacientes pacientes = new frm_pacientes(nivel_acesso);
        pacientes.setVisible(true);
        // this.setVisible(false);
    }//GEN-LAST:event_jm_menu_pacientesActionPerformed

    private void jm_menu_ordem_de_servicoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jm_menu_ordem_de_servicoActionPerformed
        frm_ordem_de_servico os = new frm_ordem_de_servico(nivel_acesso);
        os.setVisible(true);
        // this.setVisible(false);
    }//GEN-LAST:event_jm_menu_ordem_de_servicoActionPerformed
    /*
     * Método para limpar campos do frm_clinicas.
     */
    public void limparCampos(){
        tf_nome.setText("");
        tf_razao_social.setText("");
        tf_apto.setText("");
        tf_bairro.setText("");
        tf_celular.setText("");
        tf_cidade.setText("");
        tf_cnpj.setText("");
        tf_codigo.setText("");
        tf_email.setText("");
        tf_endereco.setText("");
        tf_telefone.setText("");
        tf_numero.setText("");
        cb_uf.setSelectedIndex(0);
        tf_codigo.setText("");
    }
    
    /*
     * Método para incrementar código
     */
    public void incrementarCodigo(){
        ClinicaController clinicaController = new ClinicaController();
        tf_codigo.setText(clinicaController.buscarIDProx("id_clinica") + "");
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frm_clinicas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frm_clinicas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frm_clinicas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frm_clinicas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new frm_clinicas(nivel_acesso).setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_alterar;
    private javax.swing.JButton btn_editar;
    private javax.swing.JButton btn_excluir;
    private javax.swing.JButton btn_novo;
    private javax.swing.JButton btn_pesquisar;
    private javax.swing.JButton btn_salvar;
    private javax.swing.JComboBox cb_filtrar;
    public static javax.swing.JComboBox cb_uf;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JMenuBar jm_menu;
    private javax.swing.JMenu jm_menu_ajuda;
    private javax.swing.JMenuItem jm_menu_backup;
    private javax.swing.JMenuItem jm_menu_clinicas;
    private javax.swing.JMenuItem jm_menu_conteudo_ajuda;
    private javax.swing.JMenuItem jm_menu_dentistas;
    private javax.swing.JMenu jm_menu_gerenciar;
    private javax.swing.JMenu jm_menu_opcoes;
    private javax.swing.JMenuItem jm_menu_ordem_de_servico;
    private javax.swing.JMenuItem jm_menu_pacientes;
    private javax.swing.JMenuItem jm_menu_restaurar_backup;
    private javax.swing.JMenuItem jm_menu_sair;
    private javax.swing.JMenuItem jm_menu_sobre;
    public static javax.swing.JMenuItem jm_menu_usuarios;
    private javax.swing.JPanel jp_clinicas;
    private javax.swing.JPanel jp_dados_da_clinica;
    private javax.swing.JPanel jp_dados_residenciais;
    private javax.swing.JPanel jp_pesquisa;
    public static javax.swing.JTable jt_clinicas;
    private javax.swing.JLabel lbl_apto;
    private javax.swing.JLabel lbl_bairro;
    private javax.swing.JLabel lbl_celular;
    private javax.swing.JLabel lbl_cidade;
    private javax.swing.JLabel lbl_cnpj;
    private javax.swing.JLabel lbl_codigo;
    private javax.swing.JLabel lbl_email;
    private javax.swing.JLabel lbl_endereco;
    private javax.swing.JLabel lbl_filtrar;
    private javax.swing.JLabel lbl_fone_fax;
    private javax.swing.JLabel lbl_nome;
    private javax.swing.JLabel lbl_numero;
    private javax.swing.JLabel lbl_razao_social;
    private javax.swing.JLabel lbl_uf;
    public static javax.swing.JTextField tf_apto;
    public static javax.swing.JTextField tf_bairro;
    public static javax.swing.JFormattedTextField tf_celular;
    public static javax.swing.JTextField tf_cidade;
    public static javax.swing.JFormattedTextField tf_cnpj;
    public static javax.swing.JTextField tf_codigo;
    public static javax.swing.JTextField tf_email;
    public static javax.swing.JTextField tf_endereco;
    public static javax.swing.JTextField tf_nome;
    public static javax.swing.JTextField tf_numero;
    private javax.swing.JTextField tf_pesquisar;
    public static javax.swing.JTextField tf_razao_social;
    public static javax.swing.JFormattedTextField tf_telefone;
    // End of variables declaration//GEN-END:variables
}
